<?php

if (!defined('MODULE_FILE')) {
   die('You can\'t access this file directly...');
}
require_once('mainfile.php');
global $prefix,$admin_file,$sayfa,$gun,$ay;

if(empty($ay))
$ay=date(m);
if(empty($gun))
$gun=date(d);
$ay=intval($ay);
$gun=intval($gun);
$aylar=array('','Ocak','Subat','Mart','Nisan','Mayis','Haziran','Temmuz','Ağustos','Eylül','Ekim','Kasim','Aralik');

$pagetitle='| '.$gun.' '.$aylar[$ay].' Tarihinde Olan Olaylar';
include('header.php');
OpenTable();
echo "<form action='modules.php?name=TarihteBugun' method='POST'>
Tarih Seçin :  
Gün <select name=gun>";
$selected=array();
if(empty($gun))
$selected[gun][1]='selected';
for ($i=1;$i<32;$i++) {
if ($i==$gun)
$selected[gun][$i]='selected';
echo '<option '.$selected[gun][$i].' value="'.$i.'">'.$i.'</option>';
}
echo '</select> 
Ay <select name=ay>';
if(empty($ay))
$selected[ay][1]='selected';
for ($i=1;$i<12;$i++) {
if ($i==$ay)
$selected[ay][$i]='selected';
echo '<option '.$selected[ay][$i].' value="'.$i.'">'.$aylar[$i].'</option>';
}

echo '</select> ';
echo '<input type=hidden name="op" value="TarihteBugun">
<input type=submit value="Listele">';
CloseTable();

OpenTable();
$sorgu=mysql_query("select * from ".$prefix."_tarihtebugun where tarih='".$ay." ".$gun."' order by tarih");
if(@mysql_numrows($sorgu)>0) {
echo '<table><tr>';
if(is_admin($admin))
$adminkontrol=1;
else
$adminkontrol=0;
if($adminkontrol==1)
echo '<td width=10%>İşlem</td>';
echo '<td width=15%>Tarih</td><td width=70%>Olay</td></tr>';
while($bilgi=@mysql_fetch_array($sorgu)) {
$id=$bilgi['id'];
$tarih=explode(' ',$bilgi['tarih']);
$ay=$tarih[0];
$gun=$tarih[1];
$yil=$bilgi['yil'];
$tarih=$gun.' '.$aylar[$ay].' '.$yil;
$olay=stripslashes($bilgi['olay']);
$olayuyari=str_replace("'",'',$olay);
echo '<tr>';
if($adminkontrol==1)
echo '<td><a onclick="return confirm(\''.$olayuyari.' Olayını Silecek misiniz?\');" href="'.$admin_file.'.php?op=TarihteBugunSil&id='.$id.'">Sil</a> <a href="'.$admin_file.'.php?op=TarihteBugunDuzenleme&id='.$id.'">Değiştir</a></td>';
echo '<td>'.$tarih.'</td><td>'.$olay.'</td></tr>';
}
mysql_free_result($sorgu);
echo'</table>';
}
else
echo 'Bu tarihte gerçekleşen bir olay yok';
CloseTable();
echo '<p align=right><a alt="php,webmaster,nuke,pehaspe,manual,kod,code" title="php,webmaster,nuke,pehaspe,manual,kod,code" href="http://www.pehaspe.com" target="_blank"><font color="#ffffff">www.PeHasPe.Com</font></a></p>',
include('footer.php');
?>